\documentclass[11pt,oneside,openany]{book}

% Packages
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage{amsmath,amsfonts,amssymb,amsthm}
\usepackage{graphicx}
\usepackage{tikz}
\usepackage{pgfplots}
\usepackage{booktabs}
\usepackage{array}
\usepackage{tabularx}
\usepackage{longtable}
\usepackage{multirow}
\usepackage{multicol}
\usepackage{hyperref}
\hypersetup{
    colorlinks=true,
    linkcolor=black,
    citecolor=black,
    urlcolor=black,
    filecolor=black,
    menucolor=black,
    anchorcolor=black
}
\usepackage{cleveref}
\usepackage{algorithm}
\usepackage{algorithmic}
\usepackage{listings}
\usepackage{xcolor}
\usepackage{mdframed}
\usepackage{geometry}
\usepackage{fancyhdr}
\usepackage{tocloft}
\usepackage{float}
\usepackage{caption}
\usepackage{subcaption}
\usepackage[style=alphabetic,backend=biber]{biblatex}

% Bibliography
\addbibresource{bibliography/references.bib}

% Page geometry
\geometry{
    a4paper,
    inner=3cm,
    outer=2.5cm,
    top=2.5cm,
    bottom=2.5cm,
    headsep=0.5cm,
    footskip=1cm,
    headheight=14pt
}

% Header and footer
\pagestyle{fancy}
\fancyhf{}
\fancyhead[LE]{\leftmark}
\fancyhead[RO]{\rightmark}
\fancyfoot[LE,RO]{\thepage}

% Theorem environments
\theoremstyle{plain}
\newtheorem{theorem}{Theorem}[chapter]
\newtheorem{lemma}[theorem]{Lemma}
\newtheorem{proposition}[theorem]{Proposition}
\newtheorem{corollary}[theorem]{Corollary}

\theoremstyle{definition}
\newtheorem{definition}[theorem]{Definition}
\newtheorem{example}[theorem]{Example}
\newtheorem{assumption}[theorem]{Assumption}
\newtheorem{remark}[theorem]{Remark}

% Custom theorem styles
\mdfdefinestyle{theoremstyle}{
    linewidth=1pt,
    linecolor=blue!30,
    backgroundcolor=blue!5,
    leftmargin=0pt,
    rightmargin=0pt,
    innerleftmargin=10pt,
    innerrightmargin=10pt,
    innertopmargin=10pt,
    innerbottommargin=10pt,
    roundcorner=5pt
}

% Custom commands
\newcommand{\Var}{\operatorname{Var}}
\newcommand{\StateSpace}{\mathcal{S}}
\newcommand{\Actions}{\mathcal{A}}
\newcommand{\Observation}{\mathcal{O}}
\newcommand{\Tools}{\mathcal{T}}
\newcommand{\Context}{\mathcal{C}}
\newcommand{\Belief}{\mathcal{B}}
\newcommand{\E}{\mathbb{E}}
\newcommand{\Prob}{\mathbb{P}}
\newcommand{\R}{\mathbb{R}}
\newcommand{\N}{\mathbb{N}}
\newcommand{\Z}{\mathbb{Z}}

\lstdefinestyle{python}{
    language=Python,
    basicstyle=\ttfamily\footnotesize,
    keywordstyle=\color{blue}\bfseries,
    commentstyle=\color{green!60!black},
    stringstyle=\color{red},
    numbers=left,
    numberstyle=\tiny\color{gray},
    stepnumber=1,
    numbersep=8pt,
    showstringspaces=false,
    breaklines=true,
    frame=single,
    backgroundcolor=\color{gray!10}
}

\lstdefinestyle{julia}{
    language=Julia,
    basicstyle=\ttfamily\footnotesize,
    keywordstyle=\color{blue}\bfseries,
    commentstyle=\color{green!60!black},
    stringstyle=\color{red},
    numbers=left,
    numberstyle=\tiny\color{gray},
    stepnumber=1,
    numbersep=8pt,
    showstringspaces=false,
    breaklines=true,
    frame=single,
    backgroundcolor=\color{gray!10}
}

\usetikzlibrary{arrows,shapes,positioning,shadows,trees,calc,patterns,decorations.pathmorphing}
\pgfplotsset{compat=1.18}

\title{Hierarchical Cooperation in Complex Systems\\Theory, Models, and Computational Validation}
\author{Theory and Systems Research Collective}
\date{\today}

\begin{document}

\frontmatter
\maketitle
\tableofcontents
\listoffigures
\listoftables

\chapter*{Abstract}
\addcontentsline{toc}{chapter}{Abstract}

Hierarchical cooperation captures how multi-level organizations coordinate autonomous actors while preserving adaptability. Building on statistical mechanics, information theory, and multi-agent modeling, this volume develops rigorous theory, computational mechanisms, and validation protocols for hierarchical cooperation in complex socio-technical systems. We provide formal models, proofs, simulation frameworks, experimental designs, and applied case studies, integrating theoretical narratives with reproducible toolchains.

\chapter*{Preface}
\addcontentsline{toc}{chapter}{Preface}

This manuscript extends the planning manual in \texttt{docs/theory-foundation.md} into a full LaTeX book. It synthesizes prior research artifacts, including \texttt{Hierarchical-Cooperation.md}, to deliver a consolidated theory, modeling, and validation reference. Part~I establishes mathematical foundations and information-theoretic tools. Part~II constructs specialized mechanisms spanning statistical physics, stochastic processes, and multi-agent architectures. Part~III implements computational frameworks, experimental protocols, and domain case studies. Appendices collect proofs, algorithms, statistical methods, and implementation guidance to support replication and future extensions.

\mainmatter

\part{Theoretical Foundations}
\include{chapters/chapter1_introduction}
\include{chapters/chapter2_mathematical_framework}
\include{chapters/chapter3_information_theory}

\part{Models and Mechanisms}
\include{chapters/chapter4_statistical_mechanics}
\include{chapters/chapter5_stochastic_processes}
\include{chapters/chapter6_multiagent_modeling}

\part{Computational Validation}
\include{chapters/chapter7_simulation_framework}
\include{chapters/chapter8_experimental_protocols}
\include{chapters/chapter9_case_studies}

\appendix
\include{appendices/appendix_a_proofs}
\include{appendices/appendix_b_algorithms}
\include{appendices/appendix_c_statistical_methods}
\include{appendices/appendix_d_implementation}

\backmatter
\printbibliography

\end{document}
